package com.javafactroy.kunlong.batch;

import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class JobFileRunner {
    @Autowired
    private JobLauncher jobLauncher;

    @Autowired
    @Qualifier("simpleJobNew")
    private Job simpleJobNew;
    //@Autowired
    //private Job importPersonJob;

    public void run( ) throws Exception {
        JobParameters jobParameters = new JobParametersBuilder()
                .addLong("date", System.currentTimeMillis())
                .toJobParameters();
        jobLauncher.run(simpleJobNew, jobParameters);
        //jobLauncher.run(importPersonJob, jobParameters);

  }
}
